﻿using System.Collections.Generic;
using System.IO;
using NUnit.Framework;

namespace SpellChecker.Tests
{
  [TestFixture]
  class TestLoad
  {
    [Test, ExpectedException(typeof(FileNotFoundException))]
    public void FileDoesNotExists()
    {
      SpellChecker.Load("lklökölklö.txt");
    }

    [Test]
    public void FileContainsNothing()
    {
      var inputFilename = "FileContainsWordsAsOnTheChart.txt";
      var result = SpellChecker.Load(inputFilename);
      var expected = new Dictionary<string, bool>();

      Assert.That(result, Is.EqualTo(expected));
    }


    [Test]
    public void FileContainsOneWord()
    {
      var inputFilename = "FileContainsOneWord.txt";
      var result = SpellChecker.Load(inputFilename);
      var expected = new Dictionary<string, bool>
                       {
                         {"Hallo", true},
                       };

      Assert.That(result, Is.EqualTo(expected));
    }


    [Test]
    public void FileContainsWordsAsOnTheChart()
    {
      var inputFilename = "FileContainsWordsAsOnTheChart.txt";
      var result = SpellChecker.Load(inputFilename);
      var expected = new Dictionary<string, bool>
                       {
                         {"Hallo", true},
                         {"Stefan", true},
                         {"München", true},
                         {"xyz", true},
                       };

      Assert.That(result, Is.EqualTo(expected));
    }


  }
}
